﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="InvMoveList.aspx.cs" Inherits="InvMoveList" %>

<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>店铺资料</title>
    <script src="../js/extTools.js" type="text/javascript"></script>
    <style>
        .x-column-header-inner
        {
            background-color: #157fcc;
            color: White;
            font-weight: bold;
        }
    </style>
    <script>
        var edit2 = function (editor, e) {

            // Call DirectMethod
            if (!(e.value === e.originalValue || (Ext.isDate(e.value) && Ext.Date.isEqual(e.value, e.originalValue)))) {
                CompanyX.Edit2(e.record.data.SeqCode, e.field, e.originalValue, e.value, e.record.data);
            }
        };
        var showResult = function (btn) {
            CompanyX.DeleteExpan();
        };
        var template = '<span style="color:#fff;background-color:{0};padding: 5px 10px;">{1}</span>';
        var changesate = function (value) {
            return Ext.String.format(template, (value == '未生成') ? "green" : "red", value);
        }
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <ext:ResourceManager ID="ResourceManager1" runat="server" Theme="Crisp" />
        <ext:Viewport ID="Viewport1" runat="server" Layout="FitLayout">
            <Items>
                <ext:Hidden ID="FormatType" runat="server" />
                <ext:TabPanel ID="TabPanel1" runat="server" Flex="1">
                    <Items>
                        <ext:Panel runat="server" Title="待生成费用列表" Layout="BorderLayout">
                            <Items>
                                <ext:GridPanel ID="GridPanel1" runat="server" Region="Center">
                                    <TopBar>
                                        <ext:Toolbar ID="Toolbar1" runat="server" Layout="ColumnLayout">
                                            <Items>
                                                <ext:TextField runat="server" ID="txtshop" EmptyText="输入店铺编号/名称" LabelWidth="60"
                                                    Visible="false" FieldLabel="店铺" />
                                                <ext:DateField runat="server" ID="txtbdate" FieldLabel="开始日期" />
                                                <ext:DateField runat="server" ID="txtedate" FieldLabel="截止日期" />
                                                <ext:ComboBox runat="server" ID="txtstate" FieldLabel="费用状态" Width="200">
                                                    <Items>
                                                        <ext:ListItem Value="0" Text="全部" />
                                                        <ext:ListItem Value="1" Text="未生成" />
                                                        <ext:ListItem Value="2" Text="已生成" />
                                                    </Items>
                                                    <SelectedItems>
                                                        <ext:ListItem Value="1" />
                                                    </SelectedItems>
                                                </ext:ComboBox>
                                                <ext:ComboBox runat="server" ID="txttype" FieldLabel="类型" Width="200">
                                                    <Items>
                                                        <ext:ListItem Value="0" Text="全部" />
                                                        <ext:ListItem Value="1" Text="货品" />
                                                        <ext:ListItem Value="2" Text="物料" />
                                                    </Items>
                                                    <SelectedItems>
                                                        <ext:ListItem Value="1" />
                                                    </SelectedItems>
                                                </ext:ComboBox>
                                                <ext:TextField runat="server" ID="outstockname" FieldLabel="调出仓库" />
                                                <ext:TextField runat="server" ID="instockname" FieldLabel="调入仓库" />
                                                <ext:Button ID="Button1" runat="server" Text="查询" OnDirectClick="BtnQureyUser" UI="Info">
                                                    <DirectEvents>
                                                        <Click>
                                                            <EventMask ShowMask="true" Msg="加载中...">
                                                            </EventMask>
                                                        </Click>
                                                    </DirectEvents>
                                                </ext:Button>
                                            </Items>
                                        </ext:Toolbar>
                                    </TopBar>
                                    <Store>
                                        <ext:Store ID="Store1" runat="server" PageSize="200" OnReadData="RefreshDataSet"
                                            OnSubmitData="Store1_Submit">
                                            <Model>
                                                <ext:Model ID="Model1" runat="server" IDProperty="item_id">
                                                    <Fields>
                                                    </Fields>
                                                </ext:Model>
                                            </Model>
                                        </ext:Store>
                                    </Store>
                                    <ColumnModel>
                                        <Columns>
                                        </Columns>
                                    </ColumnModel>
                                    <SelectionModel>
                                        <ext:CheckboxSelectionModel ID="CheckboxSelectionModel1" runat="server" Mode="Multi" />
                                    </SelectionModel>
                                    <BottomBar>
                                        <ext:PagingToolbar ID="PagingToolbar1" runat="server">
                                            <Items>
                                                <ext:Label ID="Label1" runat="server" Text="每页显示:" />
                                                <ext:ToolbarSpacer ID="ToolbarSpacer1" runat="server" Width="10" />
                                                <ext:ComboBox ID="ComboBox1" runat="server" Width="80">
                                                    <Items>
                                                        <ext:ListItem Text="200" />
                                                        <ext:ListItem Text="500" />
                                                        <ext:ListItem Text="1000" />
                                                    </Items>
                                                    <SelectedItems>
                                                        <ext:ListItem Value="200" />
                                                    </SelectedItems>
                                                    <Listeners>
                                                        <Select Handler="#{GridPanel1}.store.pageSize = parseInt(this.getValue(), 10); #{GridPanel1}.store.reload();" />
                                                    </Listeners>
                                                </ext:ComboBox>
                                                <ext:Button ID="Button2" runat="server" Text="导出Excel" Icon="PageExcel">
                                                    <Listeners>
                                                        <Click Handler="exportData('xls');" />
                                                    </Listeners>
                                                </ext:Button>
                                            </Items>
                                            <Plugins>
                                                <ext:ProgressBarPager ID="ProgressBarPager1" runat="server" />
                                            </Plugins>
                                        </ext:PagingToolbar>
                                    </BottomBar>
                                </ext:GridPanel>
                                <ext:Panel ID="Panel1" runat="server" Region="South" Padding="10">
                                    <Items>
                                        <ext:Button ID="Button7" runat="server" Text="生成费用单" Icon="BulletTick">
                                            <DirectEvents>
                                                <Click Before=" if(#{GridPanel1}.getSelectionModel().getCount()==0){
                                            Ext.Msg.alert('提示信息','请您至少选择一条数据!')
                                            return false;
                                            }else return true;" OnEvent="BtnShowExpen">
                                                    <EventMask Msg="正在生成..." ShowMask="true">
                                                    </EventMask>
                                                </Click>
                                            </DirectEvents>
                                        </ext:Button>
                                        <ext:Label ID="Label2" runat="server" Text="温馨提示：按住Shift键进行数据多选。" StyleSpec="color:red;"
                                            Padding="20" />
                                    </Items>
                                </ext:Panel>
                            </Items>
                        </ext:Panel>
                        <ext:GridPanel ID="GridPanel3" runat="server" Title="已生成费用列表">
                            <TopBar>
                                <ext:Toolbar ID="Toolbar2" runat="server" Layout="ColumnLayout">
                                    <Items>
                                        <ext:TextField runat="server" ID="TextField15" EmptyText="输入店铺编号/名称" LabelWidth="60"
                                            Visible="false" FieldLabel="店铺" />
                                        <ext:DateField runat="server" ID="DateField2" FieldLabel="开始日期" />
                                        <ext:DateField runat="server" ID="DateField3" FieldLabel="截止日期" />
                                        <ext:ComboBox runat="server" ID="ComboBox2" FieldLabel="费用状态" Width="200">
                                            <Items>
                                                <ext:ListItem Value="0" Text="全部" />
                                                <ext:ListItem Value="1" Text="未生成" />
                                                <ext:ListItem Value="2" Text="已生成" />
                                            </Items>
                                            <SelectedItems>
                                                <ext:ListItem Value="0" />
                                            </SelectedItems>
                                        </ext:ComboBox>
                                        <ext:Button ID="Button5" runat="server" Text="查询" OnDirectClick="BtnQureyUser2" UI="Info">
                                            <DirectEvents>
                                                <Click>
                                                    <EventMask ShowMask="true" Msg="加载中...">
                                                    </EventMask>
                                                </Click>
                                            </DirectEvents>
                                        </ext:Button>
                                    </Items>
                                </ext:Toolbar>
                            </TopBar>
                            <Store>
                                <ext:Store ID="Store3" runat="server">
                                    <Model>
                                        <ext:Model ID="Model3" runat="server" IDProperty="SeqCode">
                                            <Fields>
                                                <ext:ModelField Name="SeqCode" />
                                                <ext:ModelField Name="RecDate" />
                                                <ext:ModelField Name="Vendor" />
                                                <ext:ModelField Name="SendCode" />
                                                <ext:ModelField Name="ShipName" />
                                                <ext:ModelField Name="CityName" />
                                                <ext:ModelField Name="ShopAddrr" />
                                                <ext:ModelField Name="KindName" />
                                                <ext:ModelField Name="PriceD" />
                                                <ext:ModelField Name="PriceX" />
                                                <ext:ModelField Name="QtyD" />
                                                <ext:ModelField Name="QtyX" />
                                                <ext:ModelField Name="MoneyD" />
                                                <ext:ModelField Name="MoneyX" />
                                                <ext:ModelField Name="TotalMoney" />
                                                <ext:ModelField Name="Remark" />
                                            </Fields>
                                        </ext:Model>
                                    </Model>
                                </ext:Store>
                            </Store>
                            <ColumnModel>
                                <Columns>
                                    <ext:Column ID="Column19" runat="server" Text="费用流水号" DataIndex="SeqCode" Width="140" />
                                    <ext:DateColumn ID="DateColumn1" runat="server" Text="费用日期" DataIndex="RecDate" Width="120"
                                        Format="yyyy-MM-dd" />
                                    <ext:Column ID="Column20" runat="server" Text="物流供应商" DataIndex="Vendor" Width="100" />
                                    <ext:Column ID="Column21" runat="server" Text="运单号" DataIndex="SendCode" Width="100" />
                                    <ext:Column ID="Column22" runat="server" Text="收货人" DataIndex="ShipName" Width="150" />
                                    <ext:Column ID="Column23" runat="server" Text="到达城市" DataIndex="CityName" Width="100" />
                                    <ext:Column ID="Column24" runat="server" Text="收货地址" DataIndex="ShopAddrr" Width="100" />
                                    <ext:Column ID="Column25" runat="server" Text="货品类别" DataIndex="KindName" Width="100" />
                                    <ext:Column ID="Column26" runat="server" Text="标准价格">
                                        <Columns>
                                            <ext:Column ID="Column27" runat="server" Text="大箱" DataIndex="PriceD" Width="80" />
                                            <ext:Column ID="Column28" runat="server" Text="小箱" DataIndex="PriceX" Width="80" />
                                        </Columns>
                                    </ext:Column>
                                    <ext:Column ID="Column29" runat="server" Text="箱数">
                                        <Columns>
                                            <ext:Column ID="Column30" runat="server" Text="大箱" DataIndex="QtyD" Width="80" />
                                            <ext:Column ID="Column31" runat="server" Text="小箱" DataIndex="QtyX" Width="80" />
                                        </Columns>
                                    </ext:Column>
                                    <ext:Column ID="Column32" runat="server" Text="运费">
                                        <Columns>
                                            <ext:Column ID="Column33" runat="server" Text="大箱" DataIndex="MoneyD" Width="80" />
                                            <ext:Column ID="Column34" runat="server" Text="小箱" DataIndex="MoneyX" Width="80" />
                                        </Columns>
                                    </ext:Column>
                                    <ext:Column ID="Column35" runat="server" Text="总额" DataIndex="TotalMoney" Width="100" />
                                    <ext:Column ID="Column36" runat="server" Text="备注" DataIndex="Remark" Width="100" />
                                </Columns>
                            </ColumnModel>
                            <SelectionModel>
                                <ext:RowSelectionModel ID="CheckboxSelectionModel2" runat="server" />
                            </SelectionModel>
                            <BottomBar>
                                <ext:PagingToolbar ID="PagingToolbar2" runat="server">
                                    <Items>
                                        <ext:Label ID="Label3" runat="server" Text="每页显示:" />
                                        <ext:ToolbarSpacer ID="ToolbarSpacer2" runat="server" Width="10" />
                                        <ext:ComboBox ID="ComboBox3" runat="server" Width="80">
                                            <Items>
                                                <ext:ListItem Text="10" />
                                                <ext:ListItem Text="20" />
                                                <ext:ListItem Text="50" />
                                                <ext:ListItem Text="100" />
                                            </Items>
                                            <SelectedItems>
                                                <ext:ListItem Value="50" />
                                            </SelectedItems>
                                            <Listeners>
                                                <Select Handler="#{GridPanel1}.store.pageSize = parseInt(this.getValue(), 10); #{GridPanel1}.store.reload();" />
                                            </Listeners>
                                        </ext:ComboBox>
                                        <ext:Button ID="Button6" runat="server" Text="导出Excel" Icon="PageExcel">
                                            <Listeners>
                                                <Click Handler="exportData('xls');" />
                                            </Listeners>
                                        </ext:Button>
                                    </Items>
                                    <Plugins>
                                        <ext:ProgressBarPager ID="ProgressBarPager2" runat="server" />
                                    </Plugins>
                                </ext:PagingToolbar>
                            </BottomBar>
                        </ext:GridPanel>
                    </Items>
                </ext:TabPanel>
                <ext:Window ID="Window1" runat="server" Title="生成费用单" Icon="Accept" Height="400"
                    Layout="BorderLayout" Width="800" BodyStyle="background-color: #fff;" BodyPadding="5"
                    Hidden="true" Modal="true" Maximizable="true" Closable="false" >
                    <Items>
                        <ext:GridPanel ID="GridPanel2" runat="server" Height="200" Region="North">
                            <Store>
                                <ext:Store ID="Store2" runat="server">
                                    <Model>
                                        <ext:Model ID="Model2" runat="server" IDProperty="SeqCode">
                                            <Fields>
                                                <ext:ModelField Name="SeqCode" />
                                                <ext:ModelField Name="RecDate" />
                                                <ext:ModelField Name="Vendor" />
                                                <ext:ModelField Name="SendCode" />
                                                <ext:ModelField Name="ShipName" />
                                                <ext:ModelField Name="CityName" />
                                                <ext:ModelField Name="ShopAddrr" />
                                                <ext:ModelField Name="KindName" />
                                                <ext:ModelField Name="PriceD" />
                                                <ext:ModelField Name="PriceX" />
                                                <ext:ModelField Name="QtyD" />
                                                <ext:ModelField Name="QtyX" />
                                                <ext:ModelField Name="MoneyD" />
                                                <ext:ModelField Name="MoneyX" />
                                                <ext:ModelField Name="TotalMoney" />
                                                <ext:ModelField Name="Remark" />
                                            </Fields>
                                        </ext:Model>
                                    </Model>
                                </ext:Store>
                            </Store>
                            <ColumnModel>
                                <Columns>
                                    <ext:Column ID="Column1" runat="server" Text="费用流水号" DataIndex="SeqCode" Width="140" />
                                    <ext:DateColumn ID="Column2" runat="server" Text="费用日期" DataIndex="RecDate" Width="120"
                                        Format="yyyy-MM-dd">
                                        <Editor>
                                            <ext:DateField ID="DateField1" runat="server" Format="yyyy-MM-dd" />
                                        </Editor>
                                    </ext:DateColumn>
                                    <ext:Column ID="Column3" runat="server" Text="物流供应商" DataIndex="Vendor" Width="100">
                                        <Editor>
                                            <ext:ComboBox ID="vendorlist" runat="server" DisplayField="vendor" ValueField="vendor"
                                                QueryMode="Local" TypeAhead="true">
                                                <Store>
                                                    <ext:Store ID="Store4" runat="server">
                                                        <Model>
                                                            <ext:Model ID="Model4" runat="server">
                                                                <Fields>
                                                                    <ext:ModelField Name="vendor" />
                                                                </Fields>
                                                            </ext:Model>
                                                        </Model>
                                                    </ext:Store>
                                                </Store>
                                            </ext:ComboBox>
                                        </Editor>
                                    </ext:Column>
                                    <ext:Column ID="Column4" runat="server" Text="运单号" DataIndex="SendCode" Width="100">
                                        <Editor>
                                            <ext:TextField ID="TextField2" runat="server" />
                                        </Editor>
                                    </ext:Column>
                                    <ext:Column ID="Column5" runat="server" Text="收货人" DataIndex="ShipName" Width="180">
                                        <Editor>
                                            <ext:ComboBox ID="shoplist" runat="server" DisplayField="shopname" ValueField="shopname"
                                                QueryMode="Local" TypeAhead="true">
                                                <Store>
                                                    <ext:Store runat="server">
                                                        <Model>
                                                            <ext:Model runat="server">
                                                                <Fields>
                                                                    <ext:ModelField Name="shopname" />
                                                                </Fields>
                                                            </ext:Model>
                                                        </Model>
                                                    </ext:Store>
                                                </Store>
                                            </ext:ComboBox>
                                        </Editor>
                                    </ext:Column>
                                    <ext:Column ID="Column6" runat="server" Text="到达城市" DataIndex="CityName" Width="100" />
                                    <ext:Column ID="Column7" runat="server" Text="收货地址" DataIndex="ShopAddrr" Width="100" />
                                    <ext:Column ID="Column8" runat="server" Text="货品类别" DataIndex="KindName" Width="100">
                                        <Editor>
                                            <ext:TextField ID="TextField6" runat="server" />
                                        </Editor>
                                    </ext:Column>
                                    <ext:Column runat="server" Text="标准价格">
                                        <Columns>
                                            <ext:Column ID="Column9" runat="server" Text="大箱" DataIndex="PriceD" Width="80" />
                                            <ext:Column ID="Column10" runat="server" Text="小箱" DataIndex="PriceX" Width="80" />
                                        </Columns>
                                    </ext:Column>
                                    <ext:Column ID="Column14" runat="server" Text="箱数">
                                        <Columns>
                                            <ext:Column ID="Column11" runat="server" Text="大箱" DataIndex="QtyD" Width="80">
                                                <Editor>
                                                    <ext:TextField ID="TextField9" runat="server" />
                                                </Editor>
                                            </ext:Column>
                                            <ext:Column ID="Column12" runat="server" Text="小箱" DataIndex="QtyX" Width="80">
                                                <Editor>
                                                    <ext:TextField ID="TextField10" runat="server" />
                                                </Editor>
                                            </ext:Column>
                                        </Columns>
                                    </ext:Column>
                                    <ext:Column ID="Column18" runat="server" Text="运费">
                                        <Columns>
                                            <ext:Column ID="Column13" runat="server" Text="大箱" DataIndex="MoneyD" Width="80" />
                                            <ext:Column ID="Column16" runat="server" Text="小箱" DataIndex="MoneyX" Width="80" />
                                        </Columns>
                                    </ext:Column>
                                    <ext:Column ID="Column17" runat="server" Text="总额" DataIndex="TotalMoney" Width="100" />
                                    <ext:Column ID="Column15" runat="server" Text="备注" DataIndex="Remark" Width="100">
                                        <Editor>
                                            <ext:TextField ID="TextField14" runat="server" />
                                        </Editor>
                                    </ext:Column>
                                </Columns>
                            </ColumnModel>
                            <SelectionModel>
                                <ext:RowSelectionModel runat="server">
                                    <DirectEvents>
                                        <Select OnEvent="Cell_Click">
                                            <EventMask Msg="加载中..." ShowMask="true">
                                            </EventMask>
                                        </Select>
                                    </DirectEvents>
                                </ext:RowSelectionModel>
                            </SelectionModel>
                            <Plugins>
                                <ext:CellEditing ID="CellEditing1" runat="server" ClicksToEdit="1">
                                    <Listeners>
                                        <Edit Fn="edit2" />
                                    </Listeners>
                                </ext:CellEditing>
                            </Plugins>
                        </ext:GridPanel>
                        <ext:GridPanel ID="GridPanel4" runat="server" Region="Center">
                            <Store>
                                <ext:Store ID="Store5" runat="server" PageSize="200">
                                    <Model>
                                        <ext:Model ID="Model5" runat="server" IDProperty="item_id">
                                            <Fields>
                                            </Fields>
                                        </ext:Model>
                                    </Model>
                                </ext:Store>
                            </Store>
                            <ColumnModel>
                                <Columns>
                                </Columns>
                            </ColumnModel>
                            <SelectionModel>
                                <ext:RowSelectionModel runat="server" />
                            </SelectionModel>
                        </ext:GridPanel>
                    </Items>
                    <Buttons>
                        <ext:Button ID="Button3" runat="server" Text="确定" OnDirectClick="BtnSave">
                            <DirectEvents>
                                <Click>
                                    <EventMask ShowMask="true" Msg="正在保存中...">
                                    </EventMask>
                                </Click>
                            </DirectEvents>
                        </ext:Button>
                        <ext:Button ID="Button4" runat="server" Text="取消" OnDirectClick="Colose_Click">
                        </ext:Button>
                    </Buttons>
                </ext:Window>
            </Items>
        </ext:Viewport>
    </div>
    </form>
</body>
</html>
